package main

import "fmt"

// 定义一个自定义错误类型
type CustomError struct {
	Code    int
	Message string
}

func (e *CustomError) Error() string {
	return fmt.Sprintf("code: %d. errormsg:%s ", e.Code, e.Message)
}
func doSomething() error {
	return &CustomError{
		Code:    -1,
		Message: "kkos",
	}
}
